#!/bin/bash

if test -z "$to"; then
  echo '\$to is unset'
  exit 1
fi

if test "sus" == "$to"; then #celeron
  prt=44389
elif test "jos" == "$to"; then #amd
  prt=44510
else
  echo "invalid to='$to'"
  exit 2
fi

if test -z "$routerhost"; then
  routerhost='remoterouter' #XXX: must be set in /etc/hosts
fi
keyfile=~/ticu/dns/lekeyofhss/privk

fromremotepath="$1"
tolocalpath="$2"

if test -z "$tolocalpath"; then
  echo 'empty local dest arg'
  exit 1
fi

if test -z "$fromremotepath"; then
  echo "empty remote source arg"
  exit 2
fi

set -x
time scp -i "$keyfile" -4vp -P "$prt" root@${routerhost}:"$fromremotepath" "$tolocalpath"
#ssh -i "$keyfile" -v -p "$prt" -l root "$vncval" "$routerhost"
set +x

